import { FC, useEffect, useState } from "react";
import { Modal, Spin } from "antd";
import { useQuery } from "@tanstack/react-query";

type Props = {
  flag: number;
  id: number;
};

const ModalDetail: FC<Props> = ({ flag, id }) => {
  const [open, setOpen] = useState(false);
  useEffect(() => {
    if (!flag) return;
    setOpen(!!flag);
  }, [flag]);

  const { data, isLoading } = useQuery({
    queryKey: [id],
    queryFn() {},
  });

  return (
    <Modal
      destroyOnClose
      open={open}
      onCancel={() => setOpen(false)}
      footer={null}
      title="模块解析"
      width={900}
    >
      <Spin spinning={isLoading}>
        <div className="flex">
          <div className="w-[400px]"></div>
          <div className="flex-1"></div>
        </div>
      </Spin>
    </Modal>
  );
};

export default ModalDetail;
